package lance.honeydew.action;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import lance.honeydew.bean.CategoryBig;
import lance.honeydew.bean.CategoryMedium;
import lance.honeydew.bean.ItemInformation;
import lance.honeydew.bean.ItemStock;
import lance.honeydew.bean.OrderDetail;
import lance.honeydew.bean.OrderInformation;
import lance.honeydew.bean.PaymentMethod;
import lance.honeydew.bean.PublishMessage;
import lance.honeydew.bean.ShoppingMoney;
import lance.honeydew.bean.TransportMethod;
import lance.honeydew.bean.UserMember;
import lance.honeydew.service.ManageService;
import lance.honeydew.util.CipherUtil;
import lance.honeydew.util.DateUtil;
import lance.honeydew.util.FileUtil;
import lance.honeydew.util.MessageUtil;
import lance.honeydew.util.OrderInformationUtil;
import lance.honeydew.util.SerialNumberUtil;
import lance.honeydew.util.UserMemberUtil;

import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.orm.hibernate4.HibernateTransactionManager;

public class ManageAction extends BaseAction {

	private static final Logger logger = Logger.getLogger(ManageAction.class);

	private ManageService manageService;
	
	/*UserMember param Manage*/
	private UserMember userMemberBo;
	private UserMember userMemberQb;	
	private List<UserMember> userMemberList;
	private Long userId;
	
	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public List<UserMember> getUserMemberList() {
		return userMemberList;
	}

	public void setUserMemberList(List<UserMember> userMemberList) {
		this.userMemberList = userMemberList;
	}

	public ManageService getManageService() {
		return manageService;
	}

	public void setManageService(ManageService manageService) {
		this.manageService = manageService;
	}

	public UserMember getUserMemberQb() {
		return userMemberQb;
	}

	public void setUserMemberQb(UserMember userMemberQb) {
		this.userMemberQb = userMemberQb;
	}

	public UserMember getUserMemberBo() {
		return userMemberBo;
	}

	public void setUserMemberBo(UserMember userMemberBo) {
		this.userMemberBo = userMemberBo;
	}
	
	/*Manage Home*/
	public String execute() {
		
		UserMember user = null;
		
		user = getSessionUserMember();
		
		if (StringUtils.isNotEmpty(userMemberBo.getEmail()) && 
				StringUtils.isNotEmpty(userMemberBo.getPassword())) {
			user = manageService.checkLoginUserMember(userMemberBo.getEmail(), userMemberBo.getPassword());
		} else {
			return LOGIN;
		}
		
		if (user != null) {
			
			if (user.getIdentity().equals(UserMemberUtil.IDENTITY_MANAGER_INT) &&
					user.getState().equals(UserMemberUtil.STATE_USERMEMBER_ENABLE_INT) ) {
				setSessionUserMember(user);
				
				return SUCCESS;
			} else {
				return LOGIN;
			}
			
		} else {
			return LOGIN;
		}
	}
	
	/*UserMember Manage Action*/
	
	/**
	 * 執行會員管理畫面
	 * @return
	 */
	public String executeUserMemberMenu() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		return SUCCESS;
	}
	
	/**
	 * 會員管理-查詢功能
	 * @return
	 */
	public String queryUserMember() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			userMemberList = manageService.queryUserMemberByQb(userMemberQb, this.getPageNum(), this.getPagesize());
			
		} catch(Exception e) {
			e.printStackTrace();
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 會員管理新增畫面
	 * @return
	 */
	public String executeCreateUserMember() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 會員管理-新增-儲存功能
	 * @return
	 */
	public String saveCreateUserMember() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			/*if (userMemberBo.getPassword() != null) {
				userMemberBo.setPassword(CipherUtil.encrypt(userMemberBo.getPassword()));
			}*/
			manageService.createUserMemberByObj(userMemberBo);
			
		} catch(Exception e) {
			e.printStackTrace();
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 會員管理修改畫面
	 * @return
	 */
	public String executeUpdateUserMember() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			userMemberBo = manageService.findUserMemberByUserId(userId);
			
			if (userMemberBo.getBrithday() != null) {
				userMemberBo.setBrithdayStr(DateUtil.dbDateToStr(userMemberBo.getBrithday()));
			}
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 會員管理-修改-儲存功能
	 * @return
	 */
	public String saveUpdateUserMember() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			if (userMemberBo.getPassword() != null) {
				userMemberBo.setPassword(CipherUtil.encrypt(userMemberBo.getPassword()));
			}
			manageService.updateUserMemberByObj(userMemberBo);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 會員管理-ajax-刪除功能
	 * @return
	 */
	public String deleteUserMember() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			manageService.deleteUserMemberByUserId(getUserId());
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/*PublishMessage param Manage*/
	private PublishMessage publishMessageBo;
	private PublishMessage publishMessageQb;	
	private List<PublishMessage> publishMessageList;
	private Long pmSeqId;
	
	public PublishMessage getPublishMessageBo() {
		return publishMessageBo;
	}

	public void setPublishMessageBo(PublishMessage publishMessageBo) {
		this.publishMessageBo = publishMessageBo;
	}

	public PublishMessage getPublishMessageQb() {
		return publishMessageQb;
	}

	public void setPublishMessageQb(PublishMessage publishMessageQb) {
		this.publishMessageQb = publishMessageQb;
	}

	public List<PublishMessage> getPublishMessageList() {
		return publishMessageList;
	}

	public void setPublishMessageList(List<PublishMessage> publishMessageList) {
		this.publishMessageList = publishMessageList;
	}

	public Long getPmSeqId() {
		return pmSeqId;
	}

	public void setPmSeqId(Long pmSeqId) {
		this.pmSeqId = pmSeqId;
	}
	
	/*PublishMessage Manage Action*/	
	/**
	 * 公告管理查詢畫面
	 * @return
	 */
	public String executePublishMessageMenu() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 公告管理-查詢功能
	 * @return
	 */
	public String queryPublishMessage() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			if (StringUtils.isNotEmpty(publishMessageQb.getPublishdateStr())) {
				Date date = DateUtil.dbStrToDate(publishMessageQb.getPublishdateStr() + " 00:00:00");
				publishMessageQb.setPublishdate(date);
			}
			if (StringUtils.isNotEmpty(publishMessageQb.getFinaldateStr())) {
				Date date = DateUtil.dbStrToDate(publishMessageQb.getFinaldateStr() + " 00:00:00");
				publishMessageQb.setFinaldate(date);
			}
			
			publishMessageList = manageService.queryPublishMessageByQb(publishMessageQb, getPageNum(), getPagesize());
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 公告管理新增畫面
	 * @return
	 */
	public String executeCreatePublishMessage() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 公告管理-新增-儲存功能
	 * @return
	 */
	public String saveCreatePublishMessage() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
						
			if (StringUtils.isNotEmpty(publishMessageBo.getPublishdateStr())) {
				Date date = DateUtil.dbStrToDate(publishMessageBo.getPublishdateStr() + " 00:00:00");
				publishMessageBo.setPublishdate(date);
			}
			if (StringUtils.isNotEmpty(publishMessageBo.getFinaldateStr())) {
				Date date = DateUtil.dbStrToDate(publishMessageBo.getFinaldateStr() + " 00:00:00");
				publishMessageBo.setFinaldate(date);
			}
			
			manageService.createPublishMessageByObj(publishMessageBo);
			
		} catch(Exception e) {
			e.printStackTrace();
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 公告管理修改畫面
	 * @return
	 */
	public String executeUpdatePublishMessage() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			publishMessageBo = manageService.findPublishMessageBySeqId(pmSeqId);
			
			if (publishMessageBo.getPublishdate() != null) {
				String str = DateUtil.dbDateToStr(publishMessageBo.getPublishdate());
				publishMessageBo.setPublishdateStr(str);
			}
			if (publishMessageBo.getFinaldate() != null) {
				String str = DateUtil.dbDateToStr(publishMessageBo.getFinaldate());
				publishMessageBo.setFinaldateStr(str);
			}
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 公告管理-修改-儲存功能
	 * @return
	 */
	public String saveUpdatePublishMessage() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			if (StringUtils.isNotEmpty(publishMessageBo.getPublishdateStr())) {
				Date date = DateUtil.dbStrToDate(publishMessageBo.getPublishdateStr() + " 00:00:00");
				publishMessageBo.setPublishdate(date);
			}
			if (StringUtils.isNotEmpty(publishMessageBo.getFinaldateStr())) {
				Date date = DateUtil.dbStrToDate(publishMessageBo.getFinaldateStr() + " 00:00:00");
				publishMessageBo.setFinaldate(date);
			}
			
			boolean result = manageService.updatePublishMessageByObj(publishMessageBo);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 公告管理-刪除功能
	 * @return
	 */
	public String deletePublishMessage() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			boolean result = manageService.deletePublishMessageBySeqId(pmSeqId);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/*Payment Method Action*/
	private PaymentMethod paymentMethodBo;
	private PaymentMethod paymentMethodQb;	
	private List<PaymentMethod> paymentMethodList;
	private Long paySeqId;

	public PaymentMethod getPaymentMethodBo() {
		return paymentMethodBo;
	}

	public void setPaymentMethodBo(PaymentMethod paymentMethodBo) {
		this.paymentMethodBo = paymentMethodBo;
	}

	public PaymentMethod getPaymentMethodQb() {
		return paymentMethodQb;
	}

	public void setPaymentMethodQb(PaymentMethod paymentMethodQb) {
		this.paymentMethodQb = paymentMethodQb;
	}

	public List<PaymentMethod> getPaymentMethodList() {
		return paymentMethodList;
	}

	public void setPaymentMethodList(List<PaymentMethod> paymentMethodList) {
		this.paymentMethodList = paymentMethodList;
	}

	public Long getPaySeqId() {
		return paySeqId;
	}

	public void setPaySeqId(Long paySeqId) {
		this.paySeqId = paySeqId;
	}
	
	/**
	 * 付款方式管理查詢畫面
	 * @return
	 */
	public String executePaymentMethodMenu() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 付款方式管理-查詢功能
	 * @return
	 */
	public String queryPaymentMethod() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			paymentMethodList = manageService.queryPaymentMethodByQb(paymentMethodQb, getPageNum(), getPagesize());
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 付款方式負管理新增畫面
	 * @return
	 */
	public String executeCreatePaymentMethod() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 付款方式管理-儲存功能
	 * @return
	 */
	public String saveCreatePaymentMethod() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			boolean result = manageService.createPaymentMethodByObj(paymentMethodBo);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 付款方式管理修改畫面
	 * @return
	 */
	public String executeUpdatePaymentMethod() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			paymentMethodBo = manageService.findPaymentMethodBySeqId(paySeqId);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 付款方式管理-儲存功能
	 * @return
	 */
	public String saveUpdatePaymentMethod() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			boolean result = manageService.updatePaymentMethodByObj(paymentMethodBo);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 付款方式管理-刪除功能
	 * @return
	 */
	public String deletePaymentMethod() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			boolean result = manageService.deletePaymentMethodBySeqId(paySeqId);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/*運送方式管理*/
	private TransportMethod transportMethodBo;
	private TransportMethod transportMethodQb;	
	private List<TransportMethod> transportMethodList;
	private Long transSeqId;

	public TransportMethod getTransportMethodBo() {
		return transportMethodBo;
	}

	public void setTransportMethodBo(TransportMethod transportMethodBo) {
		this.transportMethodBo = transportMethodBo;
	}

	public TransportMethod getTransportMethodQb() {
		return transportMethodQb;
	}

	public void setTransportMethodQb(TransportMethod transportMethodQb) {
		this.transportMethodQb = transportMethodQb;
	}

	public List<TransportMethod> getTransportMethodList() {
		return transportMethodList;
	}

	public void setTransportMethodList(List<TransportMethod> transportMethodList) {
		this.transportMethodList = transportMethodList;
	}

	public Long getTransSeqId() {
		return transSeqId;
	}

	public void setTransSeqId(Long transSeqId) {
		this.transSeqId = transSeqId;
	}
	
	/**
	 * 運送方式管理查詢畫面
	 * @return
	 */
	public String executeTransportMethodMenu() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 運送方式管理-查詢功能
	 * @return
	 */
	public String queryTransportMethod() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			transportMethodList = manageService.queryTransportMethodByQb(transportMethodQb, getPageNum(), getPagesize());
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 運送方式管理新增畫面
	 * @return
	 */
	public String executeCreateTransportMethod() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			setTransportMethodBo(new TransportMethod());
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 運送方式管理-新增-儲存功能
	 * @return
	 */
	public String saveCreateTransportMethod() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			manageService.createTransportMethodByObj(transportMethodBo);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 運送方式管理修改畫面
	 * @return
	 */
	public String executeUpdateTransportMethod() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			transportMethodBo = manageService.findTransportMethodBySeqId(transSeqId);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 運送方式管理-修改-儲存功能
	 * @return
	 */
	public String saveUpdateTransportMethod() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			boolean result = manageService.updateTransportMethodByObj(transportMethodBo);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 運送方式管理-刪除功能
	 * @return
	 */
	public String deleteTransportMethod() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			boolean result = manageService.deleteTransportMethodBySeqId(transSeqId);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/*商品大類管理*/
	private CategoryBig categoryBigBo;
	private CategoryBig categoryBigQb;	
	private List<CategoryBig> categoryBigList;
	private Long catBigSeqId;

	public CategoryBig getCategoryBigBo() {
		return categoryBigBo;
	}

	public void setCategoryBigBo(CategoryBig categoryBigBo) {
		this.categoryBigBo = categoryBigBo;
	}

	public CategoryBig getCategoryBigQb() {
		return categoryBigQb;
	}

	public void setCategoryBigQb(CategoryBig categoryBigQb) {
		this.categoryBigQb = categoryBigQb;
	}

	public List<CategoryBig> getCategoryBigList() {
		return categoryBigList;
	}

	public void setCategoryBigList(List<CategoryBig> categoryBigList) {
		this.categoryBigList = categoryBigList;
	}

	public Long getCatBigSeqId() {
		return catBigSeqId;
	}

	public void setCatBigSeqId(Long catBigSeqId) {
		this.catBigSeqId = catBigSeqId;
	}
	
	/**
	 * 商品大類管理查詢畫面
	 * @return
	 */
	public String executeCategoryBigMenu() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品大類管理-查詢功能
	 * @return
	 */
	public String queryCategoryBig() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			categoryBigList = manageService.queryCategoryBigByQb(categoryBigQb, getPageNum(), getPagesize());
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品大類管理新增畫面
	 * @return
	 */
	public String executeCreateCategoryBig() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			setCategoryBigBo(new CategoryBig());
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品大類管理-新增-儲存功能
	 * @return
	 */
	public String saveCreateCategoryBig() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			boolean resutlt = manageService.createCategoryBigByObj(categoryBigBo);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品大類管理修改畫面
	 * @return
	 */
	public String executeUpdateCategoryBig() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			categoryBigBo = manageService.findCategoryBigBySeqId(catBigSeqId);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}

	/**
	 * 商品大類管理-修改-儲存功能
	 * @return
	 */
	public String saveUpdateCategoryBig() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			boolean resutlt = manageService.updateCategoryBigByObj(categoryBigBo);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品大類管理-刪除功能
	 * @return
	 */
	public String deleteCategoryBig() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			boolean resutlt = manageService.deleteCategoryBigBySeqId(catBigSeqId);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/*商品中類管理*/
	private CategoryMedium categoryMediumBo;
	private CategoryMedium categoryMediumQb;	
	private List<CategoryMedium> categoryMediumList;
	private Long catMedSeqId;
	
	public CategoryMedium getCategoryMediumBo() {
		return categoryMediumBo;
	}

	public void setCategoryMediumBo(CategoryMedium categoryMediumBo) {
		this.categoryMediumBo = categoryMediumBo;
	}

	public CategoryMedium getCategoryMediumQb() {
		return categoryMediumQb;
	}

	public void setCategoryMediumQb(CategoryMedium categoryMediumQb) {
		this.categoryMediumQb = categoryMediumQb;
	}

	public List<CategoryMedium> getCategoryMediumList() {
		return categoryMediumList;
	}

	public void setCategoryMediumList(List<CategoryMedium> categoryMediumList) {
		this.categoryMediumList = categoryMediumList;
	}

	public Long getCatMedSeqId() {
		return catMedSeqId;
	}

	public void setCatMedSeqId(Long catMedSeqId) {
		this.catMedSeqId = catMedSeqId;
	}

	/**
	 * 商品中類管理-查詢畫面
	 * @return
	 */
	public String executeCategoryMediumMenu() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			categoryBigList = manageService.findAllCategoryBigList();
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品中類管理-查詢功能
	 * @return
	 */
	public String queryCategoryMedium() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			categoryMediumList = manageService.queryCategoryMediumByQb(categoryBigQb, getPageNum(), getPagesize());
			categoryBigList = manageService.findAllCategoryBigList();
			
		} catch(Exception e) {
			e.printStackTrace();
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品中類管理-新增畫面
	 * @return
	 */
	public String executeCreateCategoryMedium() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			setCategoryMediumBo(new CategoryMedium());
			categoryBigList = manageService.findAllCategoryBigList();
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品中類管理-新增-儲存功能
	 * @return
	 */
	public String saveCreateCategoryMedium() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			CategoryBig bigObj = manageService.findCategoryBigBySeqId(categoryBigBo.getSeqid());
			
			if (bigObj != null) {
				categoryMediumBo.setCategorybigseqid(bigObj);
				boolean result = manageService.createCategoryMediumByObj(categoryMediumBo);
			}
			
			categoryBigList = manageService.findAllCategoryBigList();
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品中類管理-修改畫面
	 * @return
	 */
	public String executeUpdateCategoryMedium() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			categoryBigList = manageService.findAllCategoryBigList();
			categoryMediumBo = manageService.findCategoryMediumBySeqId(catMedSeqId);
			
			if (categoryMediumBo != null) {
				CategoryBig bigObj = manageService.findCategoryBigBySeqId(categoryMediumBo.getCategorybigseqid().getSeqid());
				setCategoryBigBo(bigObj);
			}
			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品中類管理-修改-儲存功能
	 * @return
	 */
	public String saveUpdateCategoryMedium() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			CategoryBig bigObj = manageService.findCategoryBigBySeqId(categoryBigBo.getSeqid());
			
			if (bigObj != null) {
				categoryMediumBo.setCategorybigseqid(bigObj);
				boolean result = manageService.updateCategoryMediumByObj(categoryMediumBo);
			}
			
			categoryBigList = manageService.findAllCategoryBigList();
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}	
	
	/**
	 * 商品中類管理-刪除功能
	 * @return
	 */
	public String deleteCategoryMedium() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			boolean result = manageService.deleteCategoryMediumBySeqId(catMedSeqId);
			categoryBigList = manageService.findAllCategoryBigList();
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/*購物金管理*/
	private ShoppingMoney shoppingMoneyBo;
	private ShoppingMoney shoppingMoneyQb;	
	private List<ShoppingMoney> shoppingMoneyList;
	private Long shopMonSeqId;
	private String shopMonEmail;
	private String shopMonName;

	
	public String getShopMonEmail() {
		return shopMonEmail;
	}

	public void setShopMonEmail(String shopMonEmail) {
		this.shopMonEmail = shopMonEmail;
	}

	public String getShopMonName() {
		return shopMonName;
	}

	public void setShopMonName(String shopMonName) {
		this.shopMonName = shopMonName;
	}

	public ShoppingMoney getShoppingMoneyBo() {
		return shoppingMoneyBo;
	}

	public void setShoppingMoneyBo(ShoppingMoney shoppingMoneyBo) {
		this.shoppingMoneyBo = shoppingMoneyBo;
	}

	public ShoppingMoney getShoppingMoneyQb() {
		return shoppingMoneyQb;
	}

	public void setShoppingMoneyQb(ShoppingMoney shoppingMoneyQb) {
		this.shoppingMoneyQb = shoppingMoneyQb;
	}

	public List<ShoppingMoney> getShoppingMoneyList() {
		return shoppingMoneyList;
	}

	public void setShoppingMoneyList(List<ShoppingMoney> shoppingMoneyList) {
		this.shoppingMoneyList = shoppingMoneyList;
	}

	public Long getShopMonSeqId() {
		return shopMonSeqId;
	}

	public void setShopMonSeqId(Long shopMonSeqId) {
		this.shopMonSeqId = shopMonSeqId;
	}
	
	/**
	 * 購物金管理-查詢畫面
	 * @return
	 */
	public String executeShoppingMoneyMenu() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 購物金-查詢功能
	 * @return
	 */
	public String queryShoppingMoney() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			UserMember obj = this.userMemberQb;
			if (obj != null && 
					StringUtils.isNotEmpty(obj.getEmail()) && 
					StringUtils.isNotEmpty(obj.getName())) {
				
				shoppingMoneyList = manageService.queryShoppingMoneyByQb(userMemberQb, pageNum, pageSize);
			}
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 購物金新增畫面
	 * @return
	 */
	public String executeCreateShoppingMoney() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			setUserMemberBo(new UserMember());
			setShoppingMoneyBo(new ShoppingMoney());
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 購物金-新增-儲存功能
	 * @return
	 */
	public String saveCreateShoppingMoney() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			UserMember obj = this.userMemberBo;
			
			if (obj != null && 
					StringUtils.isNotEmpty(obj.getEmail()) && 
					StringUtils.isNotEmpty(obj.getName())) {
				
				obj = manageService.findUserMemberByEmailAndName(this.userMemberBo);
				
				shoppingMoneyBo.setUserid(obj);
				boolean result = manageService.createShoppingMoneyByObj(shoppingMoneyBo);	
			}		
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 購物金修改畫面
	 * @return
	 */
	public String executeUpdateShoppingMoney() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			shoppingMoneyBo = manageService.findShoppingMoneyBySeqId(shopMonSeqId);
			userMemberBo = shoppingMoneyBo.getUserid();
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 購物金-修改-儲存功能
	 * @return
	 */
	public String saveUpdateShoppingMoney() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			shoppingMoneyBo.setUserid(userMemberBo);
			manageService.updateShoppingMoneyByObj(shoppingMoneyBo);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 購物金-刪除功能
	 * @return
	 */
	public String deleteShoppingMoney() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			boolean result = manageService.deleteShoppingMoneyBySeqId(shopMonSeqId);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/*商品資訊管理*/
	private ItemInformation itemInformationBo;
	private ItemInformation itemInformationQb;	
	private List<ItemInformation> itemInformationList;
	private Long itemInforSeqId;
	private List<Map> categoryBMList;

	public ItemInformation getItemInformationBo() {
		return itemInformationBo;
	}

	public void setItemInformationBo(ItemInformation itemInformationBo) {
		this.itemInformationBo = itemInformationBo;
	}

	public ItemInformation getItemInformationQb() {
		return itemInformationQb;
	}

	public void setItemInformationQb(ItemInformation itemInformationQb) {
		this.itemInformationQb = itemInformationQb;
	}

	public List<ItemInformation> getItemInformationList() {
		return itemInformationList;
	}

	public void setItemInformationList(List<ItemInformation> itemInformationList) {
		this.itemInformationList = itemInformationList;
	}

	public Long getItemInforSeqId() {
		return itemInforSeqId;
	}

	public void setItemInforSeqId(Long itemInforSeqId) {
		this.itemInforSeqId = itemInforSeqId;
	}

	public List<Map> getCategoryBMList() {
		return categoryBMList;
	}

	public void setCategoryBMList(List<Map> categoryBMList) {
		this.categoryBMList = categoryBMList;
	}

	/**
	 * 商品資訊管理-查詢畫面
	 * @return
	 */
	public String executeItemInformationMenu() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品資訊管理-查詢功能
	 * @return
	 */
	public String queryItemInformation() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			itemInformationList = manageService.queryItemInformationByQb(itemInformationQb, pageNum, pageSize);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品資訊管理-新增畫面
	 * @return
	 */
	public String executeCreateItemInformation() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			categoryBigList = manageService.findAllCategoryBigList();
			if (categoryBigList != null) {
				categoryBMList = new ArrayList();
				for (CategoryBig bigObj : categoryBigList) {
					String bigSidStr = bigObj.getSeqid().toString();
					List<CategoryMedium> medList = (List<CategoryMedium>) manageService.findCategoryMediumListByBigSeqId(bigObj.getSeqid());
					if (medList != null) {
						for (CategoryMedium medObj : medList) {
							String medSidStr = medObj.getSeqid().toString();
							Map map = new HashMap();
							map.put("Seqid", bigSidStr + "," + medSidStr);
							map.put("Name", bigObj.getName() + " - " + medObj.getName());
							categoryBMList.add(map);
						}						
					}
				}
			}			
			
			setItemInformationBo(new ItemInformation());
			String serialNumber = manageService.generateSerialNumber(SerialNumberUtil.TABLE_NAME_ITEMINFORMATION);
			itemInformationBo.setNumber(serialNumber);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品資訊管理-新增-儲存功能
	 * @return
	 */
	public String saveCreateItemInformation() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			String [] BMStrArray = itemInformationBo.getCategoryBMStr().split(",");
			categoryBigBo.setSeqid(new Long(BMStrArray[0]));
			categoryMediumBo.setSeqid(new Long(BMStrArray[1]));
			
			CategoryBig big = null;
			CategoryMedium med = null;
			if (categoryBigBo.getSeqid() != null) {
				big = manageService.findCategoryBigBySeqId(categoryBigBo.getSeqid());
			}
			
			if (categoryMediumBo.getSeqid() != null) {
				med = manageService.findCategoryMediumBySeqId(categoryMediumBo.getSeqid());
			}
			
			itemInformationBo.setCategorybigseqid(big);
			itemInformationBo.setCategorymedium(med);
			itemInformationBo.setCreatedate(new Date());
			itemInformationBo.setCreateuser(getSessionUserMember().getName());
			boolean result = manageService.createItemInformationByObj(itemInformationBo);			
			
		} catch(Exception e) {
			e.printStackTrace();
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品資訊管理-修改畫面
	 * @return
	 */
	public String executeUpdateItemInformation() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			
			itemInformationBo = manageService.findItemInformationBySeqId(itemInforSeqId);
			
			categoryBigList = manageService.findAllCategoryBigList();
			if (categoryBigList != null) {
				categoryBMList = new ArrayList();
				for (CategoryBig bigObj : categoryBigList) {
					String bigSidStr = bigObj.getSeqid().toString();
					List<CategoryMedium> medList = (List<CategoryMedium>) manageService.findCategoryMediumListByBigSeqId(bigObj.getSeqid());
					if (medList != null) {
						for (CategoryMedium medObj : medList) {
							String medSidStr = medObj.getSeqid().toString();
							Map map = new HashMap();
							map.put("Seqid", bigSidStr + "," + medSidStr);
							map.put("Name", bigObj.getName() + " - " + medObj.getName());
							categoryBMList.add(map);
						}						
					}
				}
			}			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品資訊管理-修改-儲存功能
	 * @return
	 */
	public String saveUpdateItemInformation() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			String [] BMStrArray = itemInformationBo.getCategoryBMStr().split(",");
			categoryBigBo.setSeqid(new Long(BMStrArray[0]));
			categoryMediumBo.setSeqid(new Long(BMStrArray[1]));
			
			CategoryBig big = null;
			CategoryMedium med = null;
			if (categoryBigBo.getSeqid() != null) {
				big = manageService.findCategoryBigBySeqId(categoryBigBo.getSeqid());
			}
			
			if (categoryMediumBo.getSeqid() != null) {
				med = manageService.findCategoryMediumBySeqId(categoryMediumBo.getSeqid());
			}
			
			itemInformationBo.setCategorybigseqid(big);
			itemInformationBo.setCategorymedium(med);
			itemInformationBo.setCreatedate(new Date());
			itemInformationBo.setCreateuser(getSessionUserMember().getName());
			boolean result = manageService.updateItemInformationByObj(itemInformationBo);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品資訊管理-刪除功能
	 * @return
	 */
	public String deleteItemInformation() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			boolean result = manageService.deleteItemInformationBySeqId(itemInforSeqId);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品資訊管理-大中類連動選單
	 * ajaxChangeCategoryBig
	 * @return
	 */
	public String ajaxChangeCategoryBig() {
		
		try {
			
			this.categoryMediumList = manageService.findCategoryMediumListByBigSeqId(catBigSeqId);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/*商品庫存管理*/
	private ItemStock itemStockBo;
	private ItemStock itemStockQb;	
	private List<ItemStock> itemStockList;
	private Long itemStockSeqId;

	public ItemStock getItemStockBo() {
		return itemStockBo;
	}

	public void setItemStockBo(ItemStock itemStockBo) {
		this.itemStockBo = itemStockBo;
	}

	public ItemStock getItemStockQb() {
		return itemStockQb;
	}

	public void setItemStockQb(ItemStock itemStockQb) {
		this.itemStockQb = itemStockQb;
	}

	public List<ItemStock> getItemStockList() {
		return itemStockList;
	}

	public void setItemStockList(List<ItemStock> itemStockList) {
		this.itemStockList = itemStockList;
	}

	public Long getItemStockSeqId() {
		return itemStockSeqId;
	}

	public void setItemStockSeqId(Long itemStockSeqId) {
		this.itemStockSeqId = itemStockSeqId;
	}
	
	/**
	 * 商品庫存管理-查詢畫面
	 * @return
	 */
	public String executeItemStockMenu() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品庫存管理-查詢功能
	 * @return
	 */
	public String queryItemStock() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			if (itemInformationQb != null) {
				itemStockList = manageService.queryItemStockByItemInformationOfNumber(itemInformationQb.getNumber());
			}			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品庫存管理-新增畫面
	 * @return
	 */
	public String executeCreateItemStock() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			setItemInformationBo(new ItemInformation());
			setItemStockBo(new ItemStock());		
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品庫存管理-新增-儲存功能
	 * @return
	 */
	public String saveCreateItemStock() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			ItemInformation itemInforObj = null;
			
			if (itemInformationBo != null && 
					StringUtils.isNotEmpty(itemInformationBo.getNumber())) {
				itemInforObj = manageService.findItemInformationByNumber(itemInformationBo.getNumber());
				
				if (itemInforObj != null) {
					itemStockBo.setItemseqid(itemInforObj);
					manageService.createItemStockByObj(itemStockBo);
				}
			}
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品庫存管理-修改畫面
	 * @return
	 */
	public String executeUpdateItemStock() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			itemStockBo = manageService.findItemStockBySeqId(itemStockSeqId);
			
			if (itemStockBo != null) {
				itemInformationBo = itemStockBo.getItemseqid();
			}
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品庫存管理-修改-儲存功能
	 * @return
	 */
	public String saveUpdateItemStock() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			ItemInformation itemInforObj = null;
			
			if (itemInformationBo != null && 
					StringUtils.isNotEmpty(itemInformationBo.getNumber())) {
				itemInforObj = manageService.findItemInformationByNumber(itemInformationBo.getNumber());
				
				if (itemInforObj != null) {
					itemStockBo.setItemseqid(itemInforObj);
					manageService.updateItemStockByObj(itemStockBo);
				}
			}
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 商品庫存管理-刪除功能
	 * @return
	 */
	public String deleteItemStock() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			boolean result = manageService.deleteItemStockBySeqId(itemStockSeqId);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/*訂單資訊管理*/
	private OrderInformation orderInformationBo;
	private OrderInformation orderInformationQb;	
	private List<OrderInformation> orderInformationList;
	private Long orderInforSeqId;

	public OrderInformation getOrderInformationBo() {
		return orderInformationBo;
	}

	public void setOrderInformationBo(OrderInformation orderInformationBo) {
		this.orderInformationBo = orderInformationBo;
	}

	public OrderInformation getOrderInformationQb() {
		return orderInformationQb;
	}

	public void setOrderInformationQb(OrderInformation orderInformationQb) {
		this.orderInformationQb = orderInformationQb;
	}

	public List<OrderInformation> getOrderInformationList() {
		return orderInformationList;
	}

	public void setOrderInformationList(List<OrderInformation> orderInformationList) {
		this.orderInformationList = orderInformationList;
	}

	public Long getOrderInforSeqId() {
		return orderInforSeqId;
	}

	public void setOrderInforSeqId(Long orderInforSeqId) {
		this.orderInforSeqId = orderInforSeqId;
	}
	
	/**
	 * 訂單資訊管理-查詢畫面
	 * @return
	 */
	public String executeOrderInformationMenu() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 訂單資訊管理-查詢功能
	 * @return
	 */
	public String queryOrderInformation() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			if (userMemberQb != null) {
				orderInformationQb.setUserid(userMemberQb);
			}
			
			orderInformationList = manageService.queryOrderInformationByQb(orderInformationQb, pageNum, pageSize);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 訂單資訊管理-新增畫面
	 * @return
	 */
	public String executeCreateOrderInformation() {
		
		try {
			
			transportMethodList = manageService.findAllTransportMethodList();
			paymentMethodList = manageService.findAllPaymentMethodList();
			setOrderInformationBo(new OrderInformation());
			String serialNumber = manageService.generateSerialNumber(SerialNumberUtil.TABLE_NAME_ORDERINFORMATION);
			orderInformationBo.setNumber(serialNumber);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 訂單資訊管理-新增-儲存功能
	 * @return
	 */
	public String saveCreateOrderInformation() {
		
		try {
			
			UserMember userObj = null;
			PaymentMethod payObj = null;
			TransportMethod transportObj = null;
			
			if (orderInformationBo != null) {
				
				if (StringUtils.isNotEmpty(orderInformationBo.getAccount())) {
					userObj = manageService
							.findUserMemberByEmail(orderInformationBo.getAccount());
				}
				
				if (userObj != null) {
					if (paymentMethodBo != null) {
						payObj = manageService
								.findPaymentMethodBySeqId(paymentMethodBo.getSeqid());
					}
					
					if (transportMethodBo != null) {
						transportObj = manageService
								.findTransportMethodBySeqId(transportMethodBo.getSeqid());
					}
					
				}
				
				if (userObj != null && payObj != null && transportObj != null) {
					orderInformationBo.setUserid(userObj);
					orderInformationBo.setPaymentmethodseqid(payObj);
					orderInformationBo.setTransportmethodseqid(transportObj);
					boolean result = manageService.createOrderInformationByObj(orderInformationBo);
				}
			}
			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 訂單資訊管理-修改畫面
	 * @return
	 */
	public String executeUpdateOrderInformation() {
		
		try {
			
			transportMethodList = manageService.findAllTransportMethodList();
			paymentMethodList = manageService.findAllPaymentMethodList();
			orderInformationBo = manageService.findOrderInformationBySeqId(orderInforSeqId);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 訂單資訊管理-修改-儲存功能
	 * @return
	 */
	public String saveUpdateOrderInformation() {
		
		try {
			
			UserMember userObj = null;
			PaymentMethod payObj = null;
			TransportMethod transportObj = null;
			
			if (orderInformationBo != null) {
				
				if (StringUtils.isNotEmpty(orderInformationBo.getAccount())) {
					userObj = manageService
							.findUserMemberByEmail(orderInformationBo.getAccount());
				}
				
				if (userObj != null) {
					if (paymentMethodBo != null) {
						payObj = manageService
								.findPaymentMethodBySeqId(paymentMethodBo.getSeqid());
					}
					
					if (transportMethodBo != null) {
						transportObj = manageService
								.findTransportMethodBySeqId(transportMethodBo.getSeqid());
					}
					
				}
				
				if (userObj != null && payObj != null && transportObj != null) {
					orderInformationBo.setUserid(userObj);
					orderInformationBo.setPaymentmethodseqid(payObj);
					orderInformationBo.setTransportmethodseqid(transportObj);
					boolean result = manageService.updateOrderInformationByObj(orderInformationBo);
				}
			}
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * 訂單資訊管理-刪除功能
	 * @return
	 */
	public String deleteOrderInformation() {
		
		try {
			
			OrderInformation orderInforObj = manageService.findOrderInformationBySeqId(orderInforSeqId);
			orderInforObj.setState(OrderInformationUtil.STATE_DISABLE_INT);
			boolean result = manageService.updateOrderInformationByObj(orderInforObj);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/*訂單明細管理*/
	private OrderDetail orderDetailBo;
	private OrderDetail orderDetailQb;	
	private List<OrderDetail> orderDetailList;
	private Long orderDetailSeqId;

	public OrderDetail getOrderDetailBo() {
		return orderDetailBo;
	}

	public void setOrderDetailBo(OrderDetail orderDetailBo) {
		this.orderDetailBo = orderDetailBo;
	}

	public OrderDetail getOrderDetailQb() {
		return orderDetailQb;
	}

	public void setOrderDetailQb(OrderDetail orderDetailQb) {
		this.orderDetailQb = orderDetailQb;
	}

	public List<OrderDetail> getOrderDetailList() {
		return orderDetailList;
	}

	public void setOrderDetailList(List<OrderDetail> orderDetailList) {
		this.orderDetailList = orderDetailList;
	}

	public Long getOrderDetailSeqId() {
		return orderDetailSeqId;
	}

	public void setOrderDetailSeqId(Long orderDetailSeqId) {
		this.orderDetailSeqId = orderDetailSeqId;
	}
	
	/**
	 * @return
	 */
	public String executeOrderDetailMenu() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * @return
	 */
	public String queryOrderDetail() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			orderDetailList = manageService.queryOrderDetailByQb(orderInformationQb, pageNum, pageSize);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * @return
	 */
	public String executeCreateOrderDetail() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * @return
	 */
	public String saveCreateOrderDetail() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			setOrderDetailBo(new OrderDetail());
			
			ItemInformation itemInforObj = null;
			OrderInformation orderInforObj = null;
			
			if(orderInformationBo != null 
					&& StringUtils.isNotEmpty(orderInformationBo.getNumber())) {
				orderInforObj = manageService
						.findOrderInformationByNumber(orderInformationBo.getNumber());
				
				if(itemInformationBo != null 
						&& StringUtils.isNotEmpty(itemInformationBo.getNumber())) {
					
					itemInforObj = manageService
							.findItemInformationByNumber(itemInformationBo.getNumber());
					
					orderDetailBo.setOrderinformationseqid(orderInforObj);
					orderDetailBo.setIteminformationseqid(itemInforObj);
					boolean result = manageService.createOrderDetailByObj(orderDetailBo);
				}
			}
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * @return
	 */
	public String executeUpdateOrderDetail() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			orderDetailBo = manageService.findOrderDetailBySeqId(orderDetailSeqId);
			if (orderDetailBo != null) {
				orderInformationBo = manageService.findOrderInformationBySeqId(orderDetailBo.getOrderinformationseqid().getSeqid());
				
				itemInformationBo = manageService.findItemInformationBySeqId(orderDetailBo.getIteminformationseqid().getSeqid());
			} else {
				return ERROR;
			}
			
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * @return
	 */
	public String saveUpdateOrderDetail() {
		
		if (this.getSessionUserMember() == null) {
			return LOGIN;
		}
		
		try {
			
			ItemInformation itemInforObj = null;
			OrderInformation orderInforObj = null;
			
			if(orderInformationBo != null 
					&& StringUtils.isNotEmpty(orderInformationBo.getNumber())) {
				orderInforObj = manageService
						.findOrderInformationByNumber(orderInformationBo.getNumber());
				
				if(itemInformationBo != null 
						&& StringUtils.isNotEmpty(itemInformationBo.getNumber())) {
					
					itemInforObj = manageService
							.findItemInformationByNumber(itemInformationBo.getNumber());
					
					orderDetailBo.setOrderinformationseqid(orderInforObj);
					orderDetailBo.setIteminformationseqid(itemInforObj);
					boolean result = manageService.updateOrderDetailByObj(orderDetailBo);
				}
			}
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}
	
	/**
	 * @return
	 */
	public String deleteOrderDetail() {
		
		try {
			
			boolean result = manageService.deleteOrderDetailBySeqId(orderDetailSeqId);
			
		} catch(Exception e) {
			logger.debug(e);
		}
		
		return SUCCESS;
	}

}
